<template>
  <div class="cust">
      <!-- 头部标签 -->
 <header>
     <van-nav-bar
  title="拜访记录"
  left-arrow
  @click-left="onClickLeft"
  right-text="新增"
  @click-right="onClickRight"
/>
 </header>
 <!-- 搜索框 -->
 <div class="search">
     <van-search
  v-model="value"
  show-action
   shape="round"
  placeholder="客户名称或拜访记录"
  @search="onSearch"
>
  <template #action>
    <div @click="onSearch">搜索</div>
  </template>
</van-search>
 </div>
 <!-- 卡片 -->
 <van-card :style="{paddingTop: '.1rem' }"  v-for='(item,index) in records' :key='index' @click="$router.push({name:'detail',params:{id:item.id}})"
  thumb="https://img01.yzcdn.cn/vant/ipad.jpeg"
>
 <template #tags >
    
     <p>拜访标题<i>{{item.visitTitle}}</i></p>
      <p><span>客户名称</span> {{item.custName}}</p>
     <p> <span>拜访时间</span>  <i>{{item.visitTime}}</i></p>
  </template>
</van-card>
  </div>
</template>

<script>
import {cust,visit} from '../../request/api'
export default {
data(){
    return{
        value: '',
            active: 2,
            records:[]
    }
},
created(){
   visit({
        current:1,
        size:10
    }).then(res=>{
        console.log(res);
        this.records=res.data.records
    })
},
 methods: {
    onClickLeft() {
      this.$router.push('/login')
    },
      onSearch(val) {
      Toast(val);
    },
     onClick(name) {
       this.$router.push(name)
    },
    onClickRight(){
      this.$router.push('/addvisit')
    }
  },
}
</script>

<style lang='less' >
*{
    font-size: .18rem!important;
    
}
.cust{
  background: white;
}
.van-card{
  background: white;
}
header{
    background: #003399;
    .van-nav-bar{background:#003399;
font-size: .2rem;
padding:3% 0 0;
.van-nav-bar__title,.van-nav-bar__text{
    color: white;
    font-size: .2rem;
}
.van-icon{
    font-size: .2rem;
    color: white;
}
     }
    
}

.van-tabs__line{
    background-color: yellow;
}
.search{
   .van-search__action{
        color:#003399;
    }
}

</style>